<template>
  <BaseMainSlot ref="zhdialay" @cancel="cancel" @save="save">
    <template v-slot:zhactbar>
      <ActionBar
        :add-active="addActive"
        :del-active="delActive"
        :edit-active="editActive"
        :cancel-active="cancelActive"
        :save-active="saveActive"
        :has-save="false"
        @add="add"
        @cancel="cancel"
        @edit="edit"
        @del="del"
        @save="save"
      />
    </template>
    <template v-slot:tablebox>
      <el-table
        ref="tableRef"
        :data="tableData"
        border
        stripe
        highlight-current-row
        max-height="88%"
        @row-click="handleEdit"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column type="index" label="序号" />
        <el-table-column prop="name" label="个体名称" width="150" />
      </el-table>
      <!-- <Pagination
        :page-size="pageSize"
        :current-page="currentPage"
        :total-size="length"
        @changePageSize="changePageSize"
        @changeCurrentPage="changeCurrentPage"
      /> -->
    </template>
    <template v-slot:form>
      <div style="width:100%;height:200px;background:#fffff">78999999999</div>
    </template>
  </BaseMainSlot>
</template>
<script>
// import Pagination from "@/components/Pagination";
import ActionBar from "@/components/ActionBar/index";
import BaseMainSlot from "@/components/BaseMainSlot/newdiaLayout";
import { mymixin } from "@/utils/mixins";
export default {
  name: "TestDemo",
  components: {
    // Pagination,
    ActionBar,
    BaseMainSlot
  },
  mixins: [mymixin],
  data() {
    return {}
  },
  mounted() {
    this.getTableDataList()
  },
  methods: {
    handleEdit(list) {
      // formData赋值操作 ...
      // 亮起修改图标
      this.editActive = true;
    },
    getTableDataList() {
      this.tableData = [
        { name: "qwe" },
        { name: "rrr" },
        { name: "asd" },
        { name: "fgh" },
        { name: "jkl" }
      ]
      // this.addblankmet();
      this.resetActionBar();
    },
    handleSelectionChange() {
      // deleteidlist 赋值
      this.delActive = true;
    },
    delmessage() {
      if (this.nowChanceStau === "del") {
        // 调用删除数据方法
        // 然后重新获取表格
        this.getTableDataList();
      }
    },
    save() {
      // 如果成功保存则重置数据--一些页面需要重置一些其他的数据也要写在下面
      this.getTableDataList();
      console.log("保存成功")
      // 保存失败提示下
    }
  }
}
</script>
